var modelId = $("#modelId").val();
var parentProcDefId = $("#parentProcDefId").val();
$.ajax({
    url: serverPath.workflowPath + "/workflow/bpmDefVar/getFlowVars",
    type: "get",
    data:{modelId:modelId,parentProcDefId:parentProcDefId},
    contentType: 'application/json',
    dataType: 'json',
    success: function(result) {
        var varsMap = result.data;
        var optionHtml="";
        var selectObj = $(".flowVars");
        if (varsMap){
            for(var i=0;i<varsMap.length;i++){
                optionHtml+="<option value='"+varsMap[i].varKey+"'>"+varsMap[i].varName+"</option>";
            }
        }
        selectObj.append(optionHtml);

    }
});

//将条件表达式追加到脚本输入框内
function addToTextarea(str){
    InitMirror.editor.insertCode(str);
};

$(".flowVars").change(function(){
    addToTextarea($(this).val());
});